// import that from '../main';
import $http from "./http";

//登录
export const submitLogin = data => {
    return $http.post("/base/login/checkUserInfo", data, {
        headers: {
            "Content-Type": "application/json"
        }
    });
};

//获取用户信息
export const getUserInfo = data => {
    return $http.post("/base/common/getUserInfo", data, {
        headers: {
            "Content-Type": "application/json"
        }
    });
};

//获得菜单接口（要权限）
export const getMenuListByRoles = data => {
    return $http.post("/base/menu/getMenuListByRoles", data, {
        headers: {
            "Content-Type": "application/json"
        }
    });
};

//demo--设备信息删除
export const delDemoInfo = data => {
    return $http.post("/operation/demo/delDemoInfo", data, {
        headers: {
            "Content-Type": "application/json"
        }
    });
};

//菜单管理---获取TreeList树图
export const getMenuTree = data => {
    return $http.post("/base/menu/getMenuTree", data, {
        headers: {
            "Content-Type": "application/json"
        }
    });
};
//菜单管理---新增菜单提交
export const menuTreeAddCommit = data => {
    return $http.post("/base/menu/editMenu", data, {
        headers: {
            "Content-Type": "application/json"
        }
    });
};

//菜单管理---获取菜单详情
export const getMenuTreeInfoById = data => {
    return $http.post("/base/menu/getMenuInfoById", data, {
        headers: {
            "Content-Type": "application/json"
        }
    });
};

//菜单管理---修改菜单提交
export const menuTreeEditCommit = data => {
    return $http.post("/base/menu/editMenu", data, {
        headers: {
            "Content-Type": "application/json"
        }
    });
};

//菜单管理---tree删除菜单
export const menuTreeDeleteCommit = data => {
    return $http.post("/base/menu/delMenu", data, {
        headers: {
            "Content-Type": "application/json"
        }
    });
};

//菜单管理---获取table
export const getUrlsByMenuId = data => {
    return $http.post("/base/menu/getUrlsByMenuId", data, {
        headers: {
            "Content-Type": "application/json"
        }
    });
};

//菜单管理---table新增保存
export const menuUrlsTableAddCommit = data => {
    return $http.post("/base/menu/editUrl", data, {
        headers: {
            "Content-Type": "application/json"
        }
    });
};

// 菜单管理---table点修改获取资源详情
export const getUrlInfoByResourceId = data => {
    return $http.post("/base/menu/getUrlInfoByResourceId", data, {
        headers: {
            "Content-Type": "application/json"
        }
    });
};

// 菜单管理---table删除
export const delUrl = data => {
    return $http.post("/base/menu/delUrl", data, {
        headers: {
            "Content-Type": "application/json"
        }
    });
};

//角色管理---获取角色列表
export const getRoleList = data => {
    return $http.post("/base/role/getRoleList", data, {
        headers: {
            "Content-Type": "application/json"
        }
    });
};

//角色管理---新增角色保存
export const saveRole = data => {
    return $http.post("/base/role/saveRole", data, {
        headers: {
            "Content-Type": "application/json"
        }
    });
};

//角色管理---点击修改获取角色详情
export const getRoleInfoById = data => {
    return $http.post("/base/role/getRoleInfoById", data, {
        headers: {
            "Content-Type": "application/json"
        }
    });
};

// 角色管理---点击删除删除角色
export const delRoleById = data => {
    return $http.post("/base/role/delRoleById", data, {
        headers: {
            "Content-Type": "application/json"
        }
    });
};

//角色管理---点击权限获取权限tree
export const getAuthTree = data => {
    return $http.post("/base/role/getAuthTree", data, {
        headers: {
            "Content-Type": "application/json"
        }
    });
};

// 角色管理---保存角色权限tree
export const saveAuthTree = data => {
    return $http.post("/base/role/saveAuthTree", data, {
        headers: {
            "Content-Type": "application/json"
        }
    });
};

// 机构管理---获取机构tree
export const getUnitData = data => {
    return $http.post("/base/unit/getUnitData", data, {
        headers: {
            "Content-Type": "application/json"
        }
    });
};

// 机构管理---新增/修改tree弹出保存
export const saveUnit = data => {
    return $http.post("/base/unit/saveUnit", data, {
        headers: {
            "Content-Type": "application/json"
        }
    });
};

//机构管理---修改tree弹出获取详情
export const getUnitInfo = data => {
    return $http.post("/base/unit/getUnitInfo", data, {
        headers: {
            "Content-Type": "application/json"
        }
    });
};

//机构管理---删除tree节点
export const deleteUnit = data => {
    return $http.post("/base/unit/deleteUnit", data, {
        headers: {
            "Content-Type": "application/json"
        }
    });
};

//机构管理---获取table表数据
export const getListData = data => {
    return $http.post("/base/unit/getListData", data, {
        headers: {
            "Content-Type": "application/json"
        }
    });
};

//机构管理---获取新增弹窗内的角色列表list获取
export const getRoleList_unit = data => {
    return $http.post("/base/unit/getRoleList", data, {
        headers: {
            "Content-Type": "application/json"
        }
    });
};

//机构管理---table新增弹窗的提交
export const saveUser = data => {
    return $http.post("/base/unit/saveUser", data, {
        headers: {
            "Content-Type": "application/json"
        }
    });
};

//机构管理---table内修改按钮点击获取详情
export const getEditUser = data => {
    return $http.post("/base/unit/getEditUser", data, {
        headers: {
            "Content-Type": "application/json"
        }
    });
};

//机构管理---table内删除按钮点击、提交
export const deleteUser = data => {
    return $http.post("/base/unit/deleteUser", data, {
        headers: {
            "Content-Type": "application/json"
        }
    });
};

//机构管理---重置密码提交
export const resetPass = data => {
    return $http.post("/base/unit/resetPass", data, {
        headers: {
            "Content-Type": "application/json"
        }
    });
};

//头部--修改密码
export const updatePassword = data => {
    return $http.post("/base/common/updatePassword", data);
};

//机构管理---禁用？启用按钮点击
export const setState = data => {
    return $http.post("/base/unit/setState", data, {
        headers: {
            "Content-Type": "application/json"
        }
    });
};

// 设备列表
export const getDevicePageList = data => {
    return $http.post("/business/device/getDevicePageList", data);
};

/* 用户共通 */
// 1-1获取公司列表（要权限）--------王智超
export const getUnitList = data => {
    return $http.post("/business/common/getUnitList", data);
};

// 1-2获取户号列表（要权限）--------张东秋
export const getAccountList = data => {
    return $http.post("/collect/common/getAccountList", data);
};

// 1-3获得codelist接口（公开）--------王智超
export const getCodelistByKind = data => {
    return $http.post("/business/common/getCodelistByKind", data, {
        headers: {
            "Content-Type": "application/json"
        }
    });
};

// 1-4上传图片（有权限）--------王智超
export const uploadAvatar = data => {
    return $http.post("/business/common/getImg", data, {
        headers: {
            "Content-Type": "multipart/form-data"
        }
    });
};
// 获取分页和时间跨度参数
export const getGwAllParm = data => {
    return $http.post("/business/common/getGwAllParm", data);
};

// 1-5获得采集点树（要权限) --王智超
export const getPointList = data => {
    return $http.post("/collect/common/getPointList", data);
};

//1-6获取公司树（要权限）--------王智超
export const getUnitTree = data => {
    return $http.post("/business/common/getUnitTree", data);
};

/****************************************/

//获取权限模块信息
export const getRoleSys_codes = data => {
    return $http.post("/base/role/getRoleSys_codes", data, {
        headers: {
            "Content-Type": "application/json"
        }
    });
};
//获取手机权限模块信息
export const getRolePhoneModule = data => {
    return $http.post("/base/role/getRolePhoneModule", data, {
        headers: {
            "Content-Type": "application/json"
        }
    });
};
//保存权限模块信息
export const saveRoleSys_codes = data => {
    return $http.post("/base/role/saveRoleSys_codes", data, {
        headers: {
            "Content-Type": "application/json"
        }
    });
};
//保存手机权限模块信息
export const saveRolePhoneModule = data => {
    return $http.post("/base/role/saveRolePhoneModule", data, {
        headers: {
            "Content-Type": "application/json"
        }
    });
};

// 获取服务器系统时间
export const getSysDate = data => {
    return $http.post("/business/common/getSysDate", data);
};

//获得图片验证码接口
export const createCode = data => {
    return $http.post("/business/getValidateCode/createCode", data);
};

//发送短信接口
export const sendCode = data => {
    return $http.post("/business/getValidateCode/sendCode", data);
};

//修改密码接口
export const resetPassword = data => {
    return $http.post("/base/common/resetPassword", data);
};

export const getTurnList = data => {
    return $http.post("/business/turn/getTurnList", data);
};

//打印机列表
export const getDeviceList = data => {
    return $http.post("/business/device/getDeviceList", data);
};

//保存工序设备
export const saveTurnDevice = data => {
    return $http.post("/business/device/saveTurnDevice", data, {
        headers: {
            "Content-Type": "application/json"
        }
    });
};
//查看工序设备
export const getTurnDevice = data => {
    return $http.post("/business/device/getTurnDevice", data);
};
//查询工序
export const getTurnListByUserId = data => {
    return $http.post("/business/turn/getTurnListByUserId", data);
};
